home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CD ROM Paradise Collection 4
/
CD ROM Paradise Collection 4 1995 Nov.iso
/
music
/
fft4wav3.zip
/
C_SOURCE.ARJ
/
VISUAL.C
< prev
Wrap
Text File
|
1994-11-22
|
23KB
|
597 lines
#include <dos.h>
#include <alloc.h>
#include <time.h>
#include <math.h>
#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
#include <vga&bmp.h>
#include <string.h>
#define MY_SIZE double /* or float or long double */
#define MY_TYPE huge /* or far if data fits in two 64 K segments */
extern unsigned _stklen;
extern int grafdriver,Grafikmodi; //in Ruhe lassen
extern int MausX,MausY; //GrafikCursor-Position
extern int maxx,maxy; //maximaler Wert fuer X/Y im Grafikmodus
extern int Farbe[20]; // 0-9=Farbe,10-19=Reserviert, siehe auch INI-Datei!
extern int maxcommands; //Anzahl der Commandline Optionen
extern char CommandLine[10][80]; // ARRAY mit Commandline Optionen
extern int Aktuell; // Nummer der ausgewählten Funktion
extern char AktuellText[81]; // Name der ausgewählten Funktion
extern char AktuellName[81]; //Name der gewählten Datei
extern double Puffer[1024]; //Bildschirm-Daten-Puffer
extern int PufferMAX; //Bildschirm-Daten-Puffer Anzahl Werte
extern double huge *real; //Pointer auf Real - Array
extern double huge *imag; //Pointer auf Imag.- Array
extern unsigned long size; //maximale Anzahl der Arrayelemente
extern long AnzahlNormal; //Anzahl Abtastwerte wenn Stereo=0
extern long AnzahlReal; //Anzahl Realwerte wenn Stereo=1
extern long AnzahlImag; //Anzahl Imaginärwerte wenn Stereo=1
extern int Stereo; //Real & Imaginär, Stereo=1;
extern int Nykill; //Nyquistkr=Samplerate/2 wenn Nykill=0
extern int FFTflag; //Zeitbereich = 0, Frequenzbereich = 1
extern double lr,or,ur,rr; //Randwerte für GrafikCursorShow...
extern double Samplerate; //Abtastrate im Zeitbereich
double div_Y=1.0; //Amplitude eines DIV
double Xrange,YrangeMAX,YrangeMIN,Yoff; //Scaleing Info...
extern void Kill();
extern void Grafik(int o);
extern void Maus(int o);
extern void saveBMP(int o);
extern void Zeichensatz();
extern int GrafikCursor(int b);
extern int GrafikCursorShow(int b,int z);
extern int GrafikCursorDraw(int b);
extern int GrafikCursorLine(int Xx,int Yy);
extern int GrafikCursorWindow(int Xx,int Yy);
extern void MausPosition(int xx,int yy);
extern int inkey(int o);
extern void zeigeHilfe(char *dateiname);
extern int zeigeMenu();
extern int huge lese_INI_Datei();
extern int zeigeDatei(char *dateiname);
extern void Directory(char *dirEXT,int o);
extern void SOUND_Import(int B16);
extern int loadALL(char *dateiname);
extern int saveALL(char *dateiname);
extern void Import(int o);
extern void Export(int o);
void fuellen(int ArT) //Eingabe von Daten mit hilfe der Maus...
{ //fuellen(0) digitale Interpolation
int a,b,c; //fuellen(1) lineare Interpolation
double e,f; //fuellen(2) SIN-Treppen Interpolation
inkey(0); //fuellen(3) Spezial Interpolation
gitter_Loop: //Looping: Eingabe der Stützstellen...
setcolor(Farbe[3]);
if(Farbe[19])outtextxy(9,maxy-9,"R I B F9 F10 Del Esc Enter");
c=GrafikCursorDraw(20);
if(c==27)return; //Abbruch?
if(c>27)
{
Kill(); //Bildschirm löschen
if((c=='i')||(c=='r')||(c=='b')) // imaginär, real oder beide zeigen
{
bothLOOP:
if(c=='r')b=AnzahlReal; else b=AnzahlImag;
if(b>maxx)b=maxx;
for(a=0;a<b;a++) { if(c=='r')Puffer[a]=real[a]; else Puffer[a]=imag[a]; }
f=0; for(a=0;a<b;a++)if((e=fabs(Puffer[a]))>f) f=e;
a=maxy/2; e=a; f=e/f; e=e+1.0; setcolor(Farbe[3]);
for(a=1;a<b;a++)line(a-1,e-f*Puffer[a-1],a,e-f*Puffer[a]);
for(a=0;a<=maxx;a+=6)putpixel(a,e,Farbe[2]);
if(c=='b') { c='r'; goto bothLOOP; }
} //Gitter zeichnen
for(a=0;a<=maxx;a+=(maxx+1)/16)for(b=0;b<=maxy;b+=4)putpixel(a,b,Farbe[2]);
for(a=0;a<=maxy;a+=(maxy+1)/12)for(b=0;b<=maxx;b+=4)putpixel(b,a,Farbe[2]);
for(b=0;b<=maxx;b+=4)putpixel(b,maxy,Farbe[2]);
for(b=0;b<=maxy;b+=4)putpixel(maxx,b,Farbe[2]);
putpixel(maxx,maxy,Farbe[2]); goto gitter_Loop;
}
setcolor(Farbe[0]); if(Farbe[19])outtextxy(9,maxy-9,"R I B F9 F10 Del Esc Enter");
Filter(ArT); //in Puffer einlesen, fehlende Stützstellen Interpolieren!
setcolor(Farbe[3]); if(Farbe[19])outtextxy(9,maxy-9,"F9 F10");
for(a=0;a<PufferMAX;a++)putpixel(a,Puffer[a],Farbe[2]);
c=inkey(2); if((c==323)||(c==324))saveBMP(c-323); //ausdrucken?
Kill(); setcolor(Farbe[1]); inkey(0);
for(a=1;a<PufferMAX;a++)line(a-1,Puffer[a-1],a,Puffer[a]);
lowpass_Loop: //Eingabe glätten / Nullpunkt_setzen
setcolor(Farbe[2]);
if(Farbe[19])outtextxy(400,maxy-9,"Mouse_L: DC=0 Mouse_R: DC=?");
setcolor(Farbe[3]);
if(Farbe[19])outtextxy(9,maxy-9,"1 2 3 4 5 6 7 8 9 0 Esc");
c=GrafikCursor(50);
inkey(0);
if(c==27)return;
if((c>='0')&&(c<='9')) //glätten?
{
a=c-'0';
if(a>0) b=2<<a; //RC-Filter
if(a==7)b=-4; //symetrisches Filter
if(a==8)b=-8; //symetrisches Filter
if(a==9)b=-16; //symetrisches Filter
if(a==0)b=-32; //symetrisches Filter
Filter(b); Kill();
setcolor(Farbe[1]);
for(a=1;a<PufferMAX;a++)
{ line(a-1,Puffer[a-1],a,Puffer[a]); }
goto lowpass_Loop;
}
if(c==2) //Nullpunkt Korrektur
{
a=MausX,b=MausY;
c=GrafikCursorLine(MausX,MausY);
inkey(0);
if(c==27)return;
e=MausY-b;
e=e/(MausX-a);
f=b-e*a;
Kill();
setcolor(Farbe[2]); settextstyle(0,0,4);
outtextxy(102,(1*maxy)/6,"Reell");
outtextxy(102,(3*maxy)/6,"Real");
outtextxy(102,(5*maxy)/6,"Imaginär");
for(a=0;a<=PufferMAX;a++)Puffer[a]=Puffer[a]-(e*a+f);
c=maxy/2; line(0,c,maxx,c); setcolor(Farbe[3]);
outtextxy(100,(1*maxy)/6-2,"Reell");
outtextxy(100,(3*maxy)/6-2,"Real");
outtextxy(100,(5*maxy)/6-2,"Imaginär"); setcolor(Farbe[1]);
for(a=1;a<PufferMAX;a++) line(a-1,c+Puffer[a-1],a,c+Puffer[a]);
}
else //kein Gleichanteil (DC=0)!
{
e=0,f=PufferMAX; for(a=0;a<PufferMAX;a++)e=e+Puffer[a];
e=e/f; for(a=0;a<PufferMAX;a++)Puffer[a]=Puffer[a]-e;
Kill();
setcolor(Farbe[2]); settextstyle(0,0,4);
outtextxy(102,(1*maxy)/6,"Reell");
outtextxy(102,(3*maxy)/6,"Real");
outtextxy(102,(5*maxy)/6,"Imaginär");
line(0,e,maxx,e); setcolor(Farbe[3]);
outtextxy(100,(1*maxy)/6-2,"Reell");
outtextxy(100,(3*maxy)/6-2,"Real");
outtextxy(100,(5*maxy)/6-2,"Imaginär"); setcolor(Farbe[1]);
for(a=1;a<PufferMAX;a++) line(a-1,e+Puffer[a-1],a,e+Puffer[a]);
}
a=(maxy+1)/12; e=-a; //auf div_Y scalieren
for(a=0;a<PufferMAX;a++)Puffer[a]=div_Y * Puffer[a]/e;
c=GrafikCursor(100);
inkey(0); //daten umweltfreundlich endlagern ?
if(c==27)return;
c=(3*MausY)/maxy;
FFTflag=0, Stereo=1, Nykill=0;
if(c==0)
{ //reelle Daten
for(a=0;a<PufferMAX;a++)
{
if ((a&1)) imag[a/2] = Puffer[a];
else real[a/2] = Puffer[a];
}
AnzahlNormal=PufferMAX; AnzahlImag=PufferMAX/2;
AnzahlReal=AnzahlImag+(PufferMAX&1); Stereo=0; return;
}
if(c==1) { AnzahlReal=PufferMAX; for(a=0;a<PufferMAX;a++)real[a]=Puffer[a]; } //Realteil
if(c==2) { AnzahlImag=PufferMAX; for(a=0;a<PufferMAX;a++)imag[a]=Puffer[a]; } //Imaginärteil
AnzahlNormal = AnzahlReal;
if (AnzahlImag<AnzahlReal) AnzahlNormal = AnzahlImag;
}
double Statistic(int o) //1=Real 2=Imag. 3=Reell
{ //Ermittelung des größten und kleinsten Wertes,
int c,d; //und der Amplitudenhäufigkeit ( in Puffer[0...maxx] )
long w; //zurückgegeben wird der am weitesten von Null entfernte Wert
double b,AmpMAX;
YrangeMAX=-1e99;
YrangeMIN= 1e99;
if((o&1)==1)
{
for(w=0;w<AnzahlReal;w++)
{
Yoff+=real[w];
if(real[w]>YrangeMAX)YrangeMAX=real[w];
if(real[w]<YrangeMIN)YrangeMIN=real[w];
}
}
if((o&2)==2)
{
for(w=0;w<AnzahlImag;w++)
{
Yoff+=imag[w];
if(imag[w]>YrangeMAX)YrangeMAX=imag[w];
if(imag[w]<YrangeMIN)YrangeMIN=imag[w];
}
}
if(YrangeMAX==YrangeMIN){ if(YrangeMAX>0.0)YrangeMIN=-1e-33; else YrangeMAX=1e-33; }
AmpMAX=fabs(YrangeMAX); b=fabs(YrangeMIN);
if(b>AmpMAX)AmpMAX=YrangeMIN; else AmpMAX=YrangeMAX;
for(w=0;w<=maxx;w++)Puffer[w]=0.0; d=(maxx/2); //Häufigkeit...
if((o&1)==1)
{
for(w=0;w<AnzahlReal;w++) { b=real[w]/fabs(AmpMAX)*d+d; Puffer[b]+=1.0; }
}
if((o&2)==2)
{
for(w=0;w<AnzahlImag;w++) { b=imag[w]/fabs(AmpMAX)*d+d; Puffer[b]+=1.0; }
}
b=0.0001;
for(w=0;w<=maxx;w++)if(Puffer[w]>b)b=Puffer[w];
for(w=0;w<=maxx;w++)Puffer[w]*=(0.9*maxy/b); //Puffer normieren
return AmpMAX;
}
void Yscale() //zeige/scaliere die Amplitude_Y (Information)
{
int z=maxy/2,o;
long w;
double r,i,ro,io;
Yoff=0.0; Grafik(1); Kill(); setcolor(Farbe[2]);
line(0,maxy,maxx,maxy); line(maxx/2,0,maxx/2,maxy);
if(Stereo)
{
line(0,z,maxx,z); setcolor(Farbe[1]); //Y-Häufigkeit real
r=Statistic(1); ro=Yoff/((double)AnzahlReal); Yoff=0.0;
for(w=0;w<=maxx;w++) if(Puffer[w]>0)line(w,z,w,z-(Puffer[w]/2.0));
i=Statistic(2); io=Yoff/((double)AnzahlImag); //Y-Häufigkeit imag.
for(w=0;w<=maxx;w++) if(Puffer[w]>0)line(w,maxy,w,maxy-(Puffer[w]/2.0));
setcolor(Farbe[3]);
sprintf(AktuellName,"Real Y-Maximum = %lg",r); outtextxy(0,0,AktuellName);
sprintf(AktuellName,"Imag.Y-Maximum = %lg",i); outtextxy(0,z+9,AktuellName);
sprintf(AktuellName,"Offset/DC = %lg",ro); outtextxy(maxx/2+9,0,AktuellName);
sprintf(AktuellName,"Offset/DC = %lg",io); outtextxy(maxx/2+9,z+9,AktuellName);
}
else
{
setcolor(Farbe[1]); r=Statistic(3); //Y-Häufigkeit reell zeigen
ro=Yoff/((double)AnzahlNormal); io=ro;
for(w=0;w<=maxx;w++) if(Puffer[w]>0)line(w,maxy,w,maxy-Puffer[w]);
for(w=0,i=0.0;w<AnzahlReal;w++) i+= (real[w]-ro) * (real[w]-ro);
for(w=0; w<AnzahlImag;w++) i+= (real[w]-ro) * (real[w]-ro);
i=sqrt(i/((double)AnzahlNormal));
setcolor(Farbe[3]);
sprintf(AktuellName," Y - Maximum = %lg",r); outtextxy(0,0,AktuellName);
sprintf(AktuellName,"Peak to Peak = %lg",YrangeMAX-YrangeMIN); outtextxy(0,9,AktuellName);
sprintf(AktuellName,"Offset/DC = %lg",ro); outtextxy(maxx/2+9,0,AktuellName);
sprintf(AktuellName,"Y_eff = %lg",i); outtextxy(maxx/2+33,9,AktuellName);
}
z=inkey(2); //warte auf Taste!
if(z==27) { Grafik(0); return; } //Escape ?
if((z==323)||(z==324))saveBMP(z-323); //drucken?
settextstyle(0,0,1); setcolor(Farbe[3]);
outtextxy(maxx/2,18," Esc Mouse_L: DC=DC Mouse_R: DC=0");
settextstyle(0,0,4);
if(Stereo)
{
outtextxy(162,(1*maxy)/6,"Real & Imag.");
outtextxy(162,(3*maxy)/6," only Real");
outtextxy(162,(5*maxy)/6," only Imag.");
setcolor(Farbe[1]);
outtextxy(161,(1*maxy)/6-1,"Real & Imag.");
outtextxy(161,(3*maxy)/6-1," only Real");
outtextxy(161,(5*maxy)/6-1," only Imag.");
setcolor(Farbe[2]);
outtextxy(160,(1*maxy)/6-2,"Real & Imag.");
outtextxy(160,(3*maxy)/6-2," only Real");
outtextxy(160,(5*maxy)/6-2," only Imag.");
}
else
{
outtextxy(82,(3*maxy)/6,"New Amplitude ?");
outtextxy(82,(5*maxy)/6," STOP!"); setcolor(Farbe[2]);
outtextxy(80,(3*maxy)/6-2,"New Amplitude ?");
outtextxy(80,(5*maxy)/6-2," STOP!");
}
z = GrafikCursor(100); //AuswahlMENÜ
o = (3*MausY) / maxy;
inkey(0); Grafik(0);
Zeichensatz();
if(z==27)return; //Esc
if((Stereo==0)&&(o!=1))return; //STOP!
if(o==0) o=3;
if(Stereo==0)o=3;
if(z==2) //DC=0
{
if((o&1)==1)for(w=0;w<AnzahlReal;w++) real[w]-=ro;
if((o&2)==2)for(w=0;w<AnzahlImag;w++) imag[w]-=io;
}
r=fabs(Statistic(1)); //no iteration effects
i=fabs(Statistic(2));
if(Stereo==0) i=fabs(Statistic(3));
gotoxy(1,11);
if(o==1)printf("old Real Maximum = %lg\n\n\rnew Real Maximum = ",r);
if(o==2)printf("old Imag.Maximum = %lg\n\n\rnew Imag.Maximum = ",i);
if(o==3)printf("old Maximum = %lg\n\rnew Maximum = ",i);
scanf("%lf",&ro); fflush(stdin);
if(Stereo)
{
if((o&1)==1)for(w=0;w<AnzahlReal;w++) real[w]*=(ro/r);
if((o&2)==2)for(w=0;w<AnzahlImag;w++) imag[w]*=(ro/i);
}
else
{
for(w=0;w<AnzahlReal;w++) real[w]*=(ro/i);
for(w=0;w<AnzahlImag;w++) imag[w]*=(ro/i);
}
}
void ZooM(int o) //0= zoom out, 1= zoom in, 2= zoom in Splitscreen
{ //-1= Y-zoom out, -2= Y-zoom in
int i,h;
double m,lx,ly,mx,my;
if(o==-1) { m=(or-ur)/2.0; or+=m; ur-=m; }
if(o==-2) { m=(or-ur)/4.0; or-=m; ur+=m; }
if(o==0)
{
m=(or-ur)*1.5; or+=m; ur-=m;
m=(rr-lr)*1.5; rr+=m; lr-=m;
if(lr<0.0)lr=0.0;
}
if(o>0)
{
lx=MausX; lx/=((double)maxx); lx=lr+lx*(rr-lr);
ly=MausY; ly/=((double)maxy); h=MausY;
inkey(0); i=GrafikCursorWindow(MausX,MausY);
inkey(0); if(i!=1)return;
mx=MausX; mx/=((double)maxx); mx=lr+mx*(rr-lr);
my=MausY; my/=((double)maxy); i=maxy/2;
if(o==2)
{
ly=( h%(i+1));
my=(MausY%(i+1));
if((MausY/i)!=(h/i))
{
if((h+MausY)/maxy)ly=ly-i;
else my=my+i;
}
ly/=i,my/=i;
}
ly=or-ly*(or-ur);
my=or-my*(or-ur);
if(ly<my) ly=or,my=ur;
if(lx>mx) m=lx,lx=mx,mx=m;
lr=lx, or=ly, rr=mx, ur=my;
}
}
void Visual(int STmode) //0=Betrag+Phase, 1=real,2=imag, 3=real&imag, 4=Betrag
{ //12=Logarithmic
int i,j,xa,ya,xb,yb,q=(maxy+1)/2; //Zeigt die Daten am Bildschirm
long w;
double b,c,d,AN=((double)(AnzahlNormal-1));
Grafik(1);
setviewport(0,0,maxx,maxy,1); //Start-Skalierung ermitteln...
YrangeMAX=-1e99;
YrangeMIN= 1e99;
for(w=0;w<AnzahlReal;w++)
{
if(real[w]>YrangeMAX)YrangeMAX=real[w];
if(real[w]<YrangeMIN)YrangeMIN=real[w];
}
for(w=0;w<AnzahlImag;w++)
{
if(imag[w]>YrangeMAX)YrangeMAX=imag[w];
if(imag[w]<YrangeMIN)YrangeMIN=imag[w];
}
if(YrangeMAX==YrangeMIN){ if(YrangeMAX>0.0)YrangeMIN= -0.001; else YrangeMAX=0.001; }
if(FFTflag) Xrange=Samplerate;
else Xrange=((double)AnzahlNormal)/Samplerate;
lr=0.0, rr=Xrange, or=YrangeMAX, ur=YrangeMIN;
ZooM(-1);
if(Stereo)
{
LooP:
Kill();
if (FFTflag) //zeichnet senkrechte Nyqistmarkierung
{
c=(Samplerate/2.0-lr)/(rr-lr)*((double)maxx);
if( (c>=0.0) && (c<=(double)maxx) && (Nykill==0))
{
for(i=0;i<=maxy;i+=6)putpixel(c,i,Farbe[3]);
for(i=0;i<=maxy;i+=4)putpixel(c,i,Farbe[3]);
}
}
c=(or-0.0)/(or-ur)*((double)maxy);
if( (c>=0.0) && (c<=(double)maxy) ) //zero-lines (Null-Linie)
{
if (STmode==3) //real&imag.
{ c=c/2.0;
for(i=0;i<=maxx;i+=6)putpixel(i,c,Farbe[3]);
for(i=0;i<=maxx;i+=6)putpixel(i,q+c,Farbe[3]);
for(i=0;i<=maxx;i+=4)putpixel(i,c,Farbe[3]);
for(i=0;i<=maxx;i+=4)putpixel(i,q+c,Farbe[3]);
}
else { for(i=0;i<=maxx;i+=6)putpixel(i,c,Farbe[3]); for(i=0;i<=maxx;i+=4)putpixel(i,c,Farbe[3]); }
}
if (STmode==3) //real&imag. (2 Fensterrahmen zeichnen)
{
j=Farbe[3]; for(i=0;i<=maxx;i+=8) putpixel(i,q,j);
for(i=0;i<=maxx;i+=8) { putpixel(i,0,j); putpixel(i,maxy,j); }
for(i=0;i<=maxy;i+=8) { putpixel(0,i,j); putpixel(maxx,i,j); }
}
setcolor(Farbe[3]);
if(Farbe[19])
{
if(STmode&1)outtextxy(maxx-32,0,"real");
if(STmode==2)outtextxy(maxx-32,0,"imag");
if(STmode==3)outtextxy(maxx-32,q,"imag");
if((STmode&3)==0)outtextxy(maxx-40,0,"polar");
outtextxy(2,maxy-9,"F1");
}
i=0,j=0;
for(w=0;w<AnzahlNormal;w++) //jetzt wird was angezeigt...
{
b=w; b=b/AN*Xrange;
d=(b-lr)/(rr-lr)*((double)maxx);
if((d<-32000.0)||(d>32000.0))continue;
if((STmode&1)==1) //Realteil
{
c=(or-real[w])/(or-ur)*((double)maxy);
if ((c>-32000.0)&&(c<32000.0))
{
if (i)
{
setcolor(Farbe[1]);
if(STmode==3)
{
setviewport(0,0,maxx,q-1,1);
line(xa,ya/2,d,(c/2.0));
}
else line(xa,ya,d,c);
}
i=1; xa=d; ya=c;
}
}
if((STmode&2)==2) //Imaginärteil
{
c=(or-imag[w])/(or-ur)*((double)maxy);
if((c>-32000.0)&&(c<32000.0))
{
if (j)
{
setcolor(Farbe[2]);
if(STmode==3)
{
setviewport(0,q,maxx,maxy,1);
line(xb,yb/2,d,(c/2.0));
}
else line(xb,yb,d,c);
}
j=1; xb=d; yb=c;
}
}
if((STmode==0)&&(real[w]!=0.0)) //Phase (falls gültig)
{
c=0.25*(3.0-atan2(imag[w],real[w])/M_PI)*((double)maxy);
setcolor(Farbe[2]);
if(j)line(xb,yb,d,c);
j=1; xb=d; yb=c;
}
if((STmode&3)==0) //Betrag
{
b=imag[w],c=real[w];
b=sqrt( b*b + c*c );
if(STmode==12) //Betrag logarithmieren?
{
if(b>0.0)b=20.0*log10(b); else b=-6000.0;
}
c=(or-b)/(or-ur)*((double)maxy);
if ((c>-32000.0)&&(c<32000.0))
{
setcolor(Farbe[1]);
if(i)line(xa,ya,d,c);
i=1; xa=d; ya=c;
}
}
}
if(STmode==0) //Skalierung der Phase zeigen
{
setcolor(Farbe[3]);
for(i=q;i<maxy;i+=(q/8)) line(maxx-9,i,maxx,i);
line(maxx-9,maxy,maxx,maxy);
outtextxy(maxx-16,q-3,"π");
outtextxy(maxx-17,q+q/2-3,"0");
outtextxy(maxx-16,maxy-8,"-π");
}
setviewport(0,0,maxx,maxy,1);
Loop0:
inkey(0); i=GrafikCursorShow(20,(STmode==3)?1:0); //warte auf Taste
if(i == 1) { ZooM((STmode==3)?2:1); goto LooP; } //Zoom IN
if(i == 2) { ZooM( 0); goto LooP; } //Zoom OUT
if(i=='-') { ZooM(-1); goto LooP; } //Y Zoom OUT
if(i=='+') { ZooM(-2); goto LooP; } //Y Zoom IN
if(i=='r') { STmode=1; goto LooP; }
if(i=='i') { STmode=2; goto LooP; }
if(i=='b') { STmode=3; goto LooP; }
if(i=='a') { STmode=4; goto LooP; }
if(i=='p') { STmode=0; goto LooP; }
if(i=='l') { STmode=12; or=3000; ur=-6500; goto LooP; }
if(i==8) //Fensterinhalt ausschneiden
{
c=lr/Xrange*AN; d=rr/Xrange*AN;
if(FFTflag)Samplerate/=(AN/(d-c));
for(AN=c;AN<=d;AN++)
{
w=((long)AN); or=real[w]; ur=imag[w];
w-=((long)c); real[w]=or; imag[w]=ur;
}
w=(long)(d-c); w++;
AnzahlNormal=w; AnzahlImag=w; AnzahlReal=w;
}
if(i==315) { setcolor(Farbe[3]);
outtextxy(3,maxy-9,"F10 F9 A L P R I B \33 Esc S X Y Z N Mouse_L:zoomIN + - Mouse_R:zoomOUT");
goto Loop0; }
if((i!=27)&&(i!=8))goto Loop0;
Grafik(0);
return; //ende
}
Loop1: //zeige Reelle Daten
Kill(); setcolor(Farbe[2]);
c=(or-0.0)/(or-ur)*((double)maxy);
if( (c>=0.0) && (c<=(double)maxy) )line(0,c,maxx,c); //zeichne Null-Linie
setcolor(Farbe[3]); if(Farbe[19])outtextxy(2,maxy-9,"F1");
setcolor(Farbe[1]);
i=0;
for(w=0;w<AnzahlNormal;w++)
{
b=w; b=b/AN*Xrange;
d=(b-lr)/(rr-lr)*((double)maxx);
if((d<-32000.0)||(d>32000.0))continue;
if((w&1))b=imag[w/2]; else b=real[w/2];
c=(or-b)/(or-ur)*((double)maxy);
if((c<-32000.0)||(c>32000.0))continue;
if(i) line(xa,ya,d,c);
i=1; xa=d; ya=c;
}
Loop2:
inkey(0); i=GrafikCursorShow(20,0); //warte auf Taste
if(i==1) { ZooM( 1); goto Loop1; } //Zoom IN
if(i==2) { ZooM( 0); goto Loop1; } //Zoom OUT
if(i=='-') { ZooM(-1); goto Loop1; } //Y-Zoom OUT
if(i=='+') { ZooM(-2); goto Loop1; } //Y-Zoom IN
if(i==8) //Fensterinhalt ausschneiden
{
c=lr/Xrange*AN; d=rr/Xrange*AN;
if(FFTflag)Samplerate/=(AN/(d-c));
for(AN=c;AN<=d;AN=AN+1.0)
{
w=((long)AN);
if((w&1))b=imag[w/2]; else b=real[w/2];
w-=((long)c);
if((w&1))imag[w/2]=b; else real[w/2]=b;
}
w=(long)(d-c); w++; AnzahlNormal=w; AnzahlImag=w/2;
AnzahlReal=AnzahlImag+(w&1);
}
if(i==315) { setcolor(Farbe[3]);
outtextxy(3,maxy-9,"F10 F9 \33 Esc S X Y Z N Mouse_L:zoomIN + - Mouse_R:zoomOUT");
goto Loop2; }
if((i!=27)&&(i!=8))goto Loop2;
Grafik(0);
}